package com.whw.fy.controller;

import com.whw.fy.entity.Academic;
import com.whw.fy.entity.Message;
import com.whw.fy.service.AcademicService;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.apache.ibatis.annotations.Param;
import org.springframework.web.bind.annotation.*;
import javax.annotation.Resource;


@Api(tags = "学术模块 ")
@RestController
@RequestMapping("/api/academic")
public class AcademicController {
    @Resource
    AcademicService academicService;

    @ApiOperation(value = "添加学术信息")
    @PostMapping("/one")
    public Message insert(Academic academic) {
        return academicService.insertSelective(academic);
    }

    @ApiOperation(value = "删除学术信息")
    @DeleteMapping("/")
    public Message delete(Integer academicId) {
        return academicService.deleteByPrimaryKey(academicId);
    }

    @ApiOperation(value = "修改学术信息")
    @PutMapping("/")
    public Message update(Academic academic) {
        return academicService.updateByPrimaryKeySelective(academic);
    }

    @ApiOperation(value = "获取所有学术信息")
    @GetMapping("/all")
    public Message selectAll(){
        return academicService.selectAll();
    }

    @ApiOperation(value = "根据学术信息id获取学术信息")
    @GetMapping("/one")
    public Message selectByPrimaryKey(Integer academicId){
        return academicService.selectByPrimaryKey(academicId);
    }

    @ApiOperation(value = "根据学术类型获取学术信息")
    @GetMapping("/type")
    public Message selectAllByAcademicType(Integer academicType){
        return academicService.selectAllByAcademicType(academicType);
    }
}
